package code;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class StudentName {

	public static void main(String[] args) {
		Student student = new Student("qingke","male",28);
        
		
			
			try {
				ObjectOutputStream ou = new ObjectOutputStream(new FileOutputStream("student2.output"));
				ou.writeObject(student);
			    ou.close();
			    ObjectInputStream in = new ObjectInputStream(new FileInputStream("student2.output"));
		        Object object;
				object = in.readObject();
				in.close();
		        System.out.println("old student"+student);
		        System.out.println("new student"+object);
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	        
		
	}

}
